﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;


namespace stadt_verlangen
{
    class GameButtons
    {

        public Vector2 position;
        public Vector2 center;
        public bool avaiable;
        public bool selected;
        public int gameNumber;
        public float rotateZoom;
        public float zoom;
        public Texture2D sprite;
        public int highscore;
        public int[] scores;
        public string name;
        

        public GameButtons(Texture2D loadTexture,Vector2 newPosition,int newGameNumber,int[] newScores,string newName)
        {
            position = newPosition;
            sprite = loadTexture;
            rotateZoom = 0.0f;
            zoom = 1.0f;
            gameNumber = newGameNumber;
            avaiable = false;
            selected = false;
            center = new Vector2(sprite.Width / 2, sprite.Height / 2);
            highscore = 0;
            name = newName;
            scores = newScores;
            
        }

        public void update  (GameTime gameTime)
        {
            if (selected)
            {
                rotateZoom += 0.1f;
                if (rotateZoom >= Math.PI * 2)
                {
                    rotateZoom = 0.0f;
                }
                zoom = (float)Math.Sin(rotateZoom);
                zoom = 1.0f + (zoom * 0.1f);
            }
            else 
            {
                zoom = 1.0f;
            }
        }

        public void draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            if (avaiable)
            {
                spriteBatch.Draw(sprite,
                    position,
                    null, 
                    Color.White,
                    0.0f,
                    center, 
                    zoom,
                    SpriteEffects.None, 
                    0);
            }
            
        }

    }
}
